﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Test
{
	/// <summary>
	/// Window1.xaml 的交互逻辑
	/// </summary>
	public partial class Window1 : Window
	{
		public Window1()
		{
			InitializeComponent();

			//this.ComboBox.DisplayMemberPath = "Key";
			//this.ComboBox.SelectedValuePath = "Value";
			//this.ComboBox.Items.Add(new System.Collections.Generic.KeyValuePair<int, int>(2, 1));

			//this.ComboBox.ItemsSource = "123456";
			//this.ComboBox.Items.Insert(0, 0);
		}

		private void CheckBox_Initialized(object sender, EventArgs e)
		{

		}

		private void GridPanel_NeedDataSource(object sender, Sunny.Controls.NeedDataSourceEventArgs e)
		{
			e.DataSource = new[]
			{
				new {A="123",B="345"},
				new {A="567",B="789"}
			}.AsQueryable();
		}

		private void Test_Click(object sender, RoutedEventArgs e)
		{
			MessageBox.Show(string.Join(",", this.GridPanel.SelectedDataKeyValues.OfType<string>().ToArray()));
		}

		//private void Button_Click(object sender, RoutedEventArgs e)
		//{
		//	//UIElement container = VisualTreeHelper.GetParent(this.Panel) as UIElement;
		//	//Point relativeLocation = this.Panel.TranslatePoint(new Point(0, 0), container);
		//	//Point point=new Point();
		//	//this.Panel.TranslatePoint(point, (UIElement)this.Panel.Parent);
		//	//MessageBox.Show(relativeLocation.ToString());
		//	MessageBox.Show(this.Panel.TranslatePoint(new Point(), (UIElement)this.Panel.Parent).ToString());
		//}
	}
}